Display information about OS where the script is runningΒΆ
Display some information about the OS where the script is running.
import platform as pl
os_profile = [
'architecture',
'linux_distribution',
'mac_ver',
'machine',
'node',
'platform',
'processor',
'python_build',
'python_compiler',
'python_version',
'release',
'system',
'uname',
'version',
]
for key in os_profile:
if hasattr(pl, key):
print(key + ": " + str(getattr(pl, key)()))
Output:
architecture: ('64bit', 'ELF')
linux_distribution: ('Ubuntu', '16.04', 'xenial')
mac_ver: ('', ('', '', ''), '')
machine: x86_64
node: 9a911676793b
platform: Linux-4.4.0-57-generic-x86_64-with-Ubuntu-16.04-xenial
processor: x86_64
python_build: ('default', 'Nov 17 2016 17:05:23')
python_compiler: GCC 5.4.0 20160609
python_version: 3.5.2
release: 4.4.0-57-generic
system: Linux
uname: uname_result(system='Linux', node='9a911676793b', release='4.4.0-57-generic', version='#78-Ubuntu SMP Fri Dec 9 23:50:32 UTC 2016', machine='x86_64', processor='x86_64')
version: #78-Ubuntu SMP Fri Dec 9 23:50:32 UTC 2016